<?php
/*
 * @Author: 李志刚
 * @CopyRight: 2020-2030 衡水山木枝技术服务有限公司
 * @Date: 2021-10-19 10:45:06
 * @Description: 用户消费记录，包括充值记录，积分记录
 * @LastEditors: 李志刚
 * @LastEditTime: 2021-10-20 09:07:57
 * @FilePath: /归档/user/2021_10_19_104506_create_user_consume.php
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserConsume extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_consumes', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->id();
            $table->foreignId('user_id')->default(0)->comment('用户ID');
            $table->unsignedDecimal('money')->default(0)->comment('使用积分');
            $table->string('order_sn', 30)->default('')->comment('订单号');
            $table->tinyInteger('type')->default(0)->comment('类型 1使用 2退回 3充值');
            $table->tinyInteger('money_type')->default(0)->comment('1金额 2积分');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_consumes');
    }
}
